package Code.Objects.Characters.Player.GUI;

import org.jrabbit.base.managers.window.WindowManager;
import org.jrabbit.standard.game.graphics.skins.image.ImageSkin;
import org.jrabbit.standard.game.objects.Sprite;
import org.lwjgl.opengl.GL11;

import Code.Objects.Characters.Player.Weapons.PlayerWeapon;

public class WeaponSelector extends Sprite
{
	private ImageSkin selected;
	
	private Sprite front;
	

	public WeaponSelector()
	{
		super("Resources/Images/GUI/Game/Weapon Selection/Weapon Selection Back.png");
		location.set(getScaledWidth() / 2, WindowManager.getDisplayHeight() - (getScaledHeight() / 2));
		useScreenCoords(true);
		
		selected = new ImageSkin("Resources/Images/GUI/Game/Weapon Selection/Weapon Highlight.png");
		
		front = new Sprite("Resources/Images/GUI/Game/Weapon Selection/Weapon Selection Front.png");
		front.useScreenCoords(true);
		front.location().set(front.getScaledWidth()  / 2, WindowManager.getDisplayHeight() - (front.getScaledHeight() / 2));
	}

	
	public void render(PlayerWeapon[] weapons, int selection)
	{
		bind();
		draw();
		
		GL11.glTranslatef(-119, -5, 0);
		for(int i = 0; i < weapons.length; i++)
		{
			if(i == selection)
			{
				GL11.glTranslatef(1, 5, 0);
				selected.render();
				GL11.glTranslatef(-1, -5, 0);
			}
			weapons[i].renderIcon();
			GL11.glTranslatef(45, 0, 0);
		}
		release();
		front.render();
	}
}